<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../react18/react.development.js"></script>
  <script src="../react18/react-dom.development.js"></script>
  <!-- 引入Babel的包,用来解析JSX语法为JS语法 -->
  <script src="../react18/babel.min.js"></script>
  <style>
    .outer {
      width: 100%;
      height: 600px;
      background-color:aqua;
    }
  </style>
</head>

<body>
  <div id="app"></div>

  <!-- 如果需要bable对当前的script内部的jsx编译,则需要设置script的type属性 -->
  <script type="text/babel">
    //使用jsx方式创建虚拟DOM 案例1
    // const vDOM = <div> hello JSX </div>

    //使用jsx方式创建虚拟DOM 案例2
    // const vDOM = (
    //   <div className="outer">
    //     <h1>JSX</h1>
    //     <p>JSX贼方便</p>
    //   </div>
    // );

      /* const vDom = (
        <div className="outer">
          <h1>JSX</h1>
          <p>JSX贼方便</p>
       </div>
      )

      console.log("虚拟DOM",vDom);


      const oApp = document.getElementById('app');
      console.dir(oApp);


    //创建容器并渲染虚拟DOM
    ReactDOM.createRoot(document.getElementById("app")).render(vDom) */




    // 使用jsx方式创建虚拟DOM
    const vDom = (
      <div className = "outer">
        <h1>JSX</h1>
        <p>JSX贼方便</p>
      </div>
    )


    //创建容器并渲染虚拟DOM
    ReactDOM.createRoot(document.getElementById('app')).render(vDom)

  </script>
</body>

</html>